<template>
	<view class="">
		<video @error="videoErro" id="myVideo" :show-center-play-btn="false" :show-play-btn="false" 
			:show-progress="false" :style="{height:playHeight+'px'}" :custom-cache="false" style="width: 100%;"
			@play="videoPlay" :src="videoPlayUrl" :muted="videMuted" :autoplay="videAoutoplay" />
		<!-- <view v-html="videoHtml"></view> -->
		<j-device-login ref="deviceLogin" :device="device" @submit="submit"></j-device-login>
		<!-- 设备状态弹窗 -->
		<j-modal :value="LightSleepStatus" :showCancel="false" :title="$t('General.device.title')"
			@ok="closeSleepStatusPopup('LightSleep')">
			<view slot="content">
				{{ $t('General.device.tip1') }}
			</view>
		</j-modal>
		<j-modal :value="DeepSleepStatus" :showCancel="false" :title="$t('General.device.title')"
			@ok="closeSleepStatusPopup('DeepSleep')">
			<view slot="content">
				{{ $t('General.device.tip2') }}
			</view>
		</j-modal>
		<j-modal :value="noDataStatus" :title="$t('General.device.title')" @cancel="closeSleepStatusPopup('back')"
			@ok="closeSleepStatusPopup('noData')">
			<view slot="content">
				{{ $t('General.device.tip3') }}
			</view>
		</j-modal>
		<j-modal :value="clickTalkStatus" :title="$t('General.device.title')" :showCancel="false"
			@ok="closeSleepStatusPopup('closeTalkStatus')">
			<view slot="content">
				{{ $t('General.device.tip4') }}
			</view>
		</j-modal>
	</view>
</template>

<script>
	const {
		convertdBm2RSSI,
		isDoorLock
	} = require('@/utils/util.js');
	let constant = getApp().globalData.constant;
	export default {
		data() {
			return {
				list: {
					number: 98
				},
				device: { // 设备对象
					deviceName: ''
				},
				deviceList: [], // 缓存列表
				isCache: false, // 是否存在缓存
				timer: null, //保活定时器
				keepAliveCount: 0, // 保活次数迭代变量
				/** 推流相关 */
				videoContext: {}, // 视频对象
				url: '',
				stream: '1', // 高清还是标清（标清用: 1 表示， 高清用: 0 表示）
				streamText: '标清', // 高清还是标清文本说明
				streamTextIcon: 'FHD', // 高清还是标清icon
				isFullScreen: false, //是否全屏
				isShowBar: true, // 显示隐藏bar控条
				isLoading: true, //加载中
				loadingText: '正在获取视频播放地址...', //加载中文字说明
				time: 3, // 时间间隔
				/** 云服务 */
				isCloud: true,
				cloudText: '',
				//静音
				mutedIcon: 'https://statics.xmcsrv.net/weixin/soundoff2.png',
				wifiUrl: null,
				isMute: true,
				tempIsMute: false,
				isClose: false,
				isShowHD: false,
				hdText: '标清',
				isHd: false,
				show: false,
				isPush: false,
				isLoginSuccess: true,
				isLogin: false,
				navTitle: '',
				bl: null,
				bal: null,
				hideType: 1,
				isLogout: false,
				isShowLock: true,
				isShowPlayBtn: false,
				isStartPlay: false,
				deviceStatus: '',
				pathType: 1,
				disConnectCount: 0,
				isShowDeepSleepModal: false,
				isShowLightSleepModal: false,
				LightSleepStatus: false,
				DeepSleepStatus: false,
				isFirstFrame: false,
				playType: 0,
				isShowBg: true,
				noDataStatus: false,
				isSupportSpeak: false,
				playOrNot: null,
				clickTalkStatus: false,
				isSupportVideoTalk: false, //是否支持双向视频对讲
				powerSavingMode: {}, //省电模式

				videAoutoplay: false, //自动播放
				videMuted: true, //静音
				videoPlayUrl: '',
				playHeight: '',
				videoContext: null,
			};
		},
		computed: {
			videoHtml: function() {
				return `<video  autoplay loop muted controls="controls" width="100%" height="570px"><source src="${this.videoPlayUrl}" type="video/mp4"></video>`;
			}
		},
		onLoad(options) {
			let enData = decodeURIComponent(options.device)
			this.device = JSON.parse(enData)
			this.playOrNot = options.playOrNot
			let definition = uni.getStorageSync('definition') //清晰度
			uni.setStorageSync('deviceToken', this.device.token)
			getApp().globalData.deviceToken = this.device.token
			this.getCurrentDevice(this.device);
			uni.setNavigationBarTitle({
				title: this.device.deviceName
			});
			this.navTitle = this.device.deviceName
			this.isShowLock = this.device.localUiKey == 'ui_doorbell' ? false : true
			uni.$on('onWebsocketMessage', this.getLiveMqttInfoCallback)
			this.envVersion = ''
			//监听小程序退到后台
			uni.$on('appLogout', (data) => {
				this.closeAllLinks(1)
			})
			if (options.type) {
				this.pathType = options.type
			}
		},
		onShow() {
			this.getClineHeight()
			this.autoPause = true
			if (this.playOrNot == 'suspend') {
				this.isShowPlayBtn = true
			} else {
				this.isShowPlayBtn = false
			}
			this.hideType = 1
			this.isLogout = false
			this.isFirstFrame = false
			this.getDeviceTypePropList();
			uni.$on('editDeviceName', (data) => {
				if (data.sn == this.device.deviceNo) {
					this.navTitle = data.deviceName
					this.device.deviceName = data.deviceName
				}
			})
		},
		onHide() {
			uni.hideLoading()
			this.autoPause = false
			this.closeAllLinks(this.hideType);
		},
		onUnload() {
			uni.hideLoading()
			this.closeAllLinks(1)
			const arr = isDoorLock()
			const list = arr.filter(item => item === this.device.parentPid)
			console.log(list)
			if (list.length) {
				uni.$emit('deviceLogout', {
					isBack: true,
					deviceNo: this.device.deviceNo,
					token: this.device.token,
					localUiKey: this.device.localUiKey || ''
				})
			}
			this.isLogout = true
			uni.$emit('backCloudMsg', {
				isBack: true
			})
			uni.$off('onWebsocketMessage', this.getLiveMqttInfoCallback)
			clearInterval(this.talkTimerID)
		},
		methods: {
			getClineHeight() {
				uni.getSystemInfo({
					success: (res => {
						this.playHeight = res.windowHeight
					})
				});
			},
			getLiveMqttInfoCallback(res) {
				let info = JSON.parse(res)
				let page = getCurrentPages()
				if (info.sn == this.device.deviceNo) {
					console.log('播放页接收数据', JSON.parse(res));
					info.props.forEach(item => {
						if (item.propCode == "wifiSignal") {
							this.wifiUrl = convertdBm2RSSI(item.propValue, 3)
						}
						if (item.propCode == "batteryPower") {
							this.bl = item.propValue
						}
						if (item.propCode == "remoteUnlock") {
							let flag = uni.getStorageSync('isCurrentUserUnlock') ? uni.getStorageSync(
								'isCurrentUserUnlock') : false
							if (flag) {
								uni.showToast({
									title: '开锁成功',
									duration: 2000,
									success: () => {
										setTimeout(() => {
											this.backAction()
										}, 2000)
									}
								})
							}
							uni.setStorageSync('isCurrentUserUnlock', false)
						}
						if (item.propCode == "remoteUnlockFailed") {}
						if (item.propCode == "deviceTerminatedCall") {}
						// DeepSleep深度休眠,LightSleep轻度休眠,WakeUp唤醒,PreSleep准备休眠
						if (item.propCode == "sleepState") {
							console.log('播放页接收数据设备状态', item.propValue);
							let millTime = info.timeStamp
							this.deviceStatus = item.propValue
							if (this.deviceStatus == 'DeepSleep') {
								uni.hideLoading()
								// ();
								if (!this.isShowDeepSleepModal) {
									if (page[page.length - 1].$page.fullPath.includes('live-lexin')) {
										this.DeepSleepStatus = true
										this.isShowDeepSleepModal = true
									}
								}
							}
							if (this.deviceStatus == 'LightSleep') {
								this.onDeviceLightSleep()
							}
							if (this.deviceStatus == 'PreSleep') {
								if (page[page.length - 1].$page.fullPath.includes('live-lexin')) {
									return uni.showToast({
										title: '准备休眠中',
										icon: 'none'
									})
								}
							}
							// 锁板准备休眠中
							if (this.deviceStatus == 'MasterControlPreSleep') {}
							if (this.deviceStatus == 'WakeUp') {}
							if (this.deviceStatus == 'OffLine') {}
						}
					})
				}
			},
			//监听设备进入浅休眠状态时逻辑处理
			onDeviceLightSleep() {
				let page = getCurrentPages()
				uni.hideLoading()
				this.isStartPlay = false
				this.isShowPlayBtn = this.hideType == 2 ? false : true
				this.deviceLogOut()
				clearInterval(this.timer);
				this.timer = null
				clearInterval(getApp().globalData.keepTimer);
				getApp().globalData.keepTimer = null
				if (!this.isShowLightSleepModal) {
					if (page[page.length - 1].$page.fullPath.includes('live-lexin') || page[page.length - 1].$page.fullPath
						.includes('live-familyCall')) {
						this.LightSleepStatus = true
						this.isShowLightSleepModal = true;
					}
				}
			},
			closeSleepStatusPopup(type) {
				if (type == 'LightSleep') {
					this.LightSleepStatus = false
					this.isShowLightSleepModal = false
				}
				if (type == 'DeepSleep') {
					this.DeepSleepStatus = false
					this.isShowDeepSleepModal = false
					this.backAction()
				}
				if (type == 'noData') {
					this.noDataStatus = false
					this.continuePlay()
				}
				if (type == 'back') {
					this.backAction()
				}
				if (type == 'closeTalkStatus') {
					this.clickTalkStatus = false
				}
			},
			continuePlay(type) {
				console.log('继续播放===', type, this.playType);
				if (this.playOrNot == 'suspend') {
					this.isShowBg = false
				}
				this.deviceStatus = 'WakeUp'
				if (this.playType == 1) {
					this.disConnectCount = 0
					this.isFirstFrame = false
					this.livestream()
				} else {
					this.loginOrAuto();
				}
				this.isShowPlayBtn = false
				this.videoContext.play()

			},
			//获取设备支持的属性列表
			getDeviceTypePropList() {
				uni.showLoading({})
				let data = {
					pid: this.device.pid,
					page: 1,
					limit: 999
				};
				getApp().globalData.api.getDeviceTypePropListByPageForApp(data, (result) => {
					uni.hideLoading()
					let mainStream = false
					let extraStream = false
					let nonMic = false //无麦克风
					let nonSpeaker = false //无扬声器
					result.data.forEach((item) => {
						if (item.propCode == 'fullDuplex' || item.propCode == 'halfDuplex ') {
							this.isSupportSpeak = true
						}
						if (item.propCode == 'mainStream') {
							mainStream = true
						}
						if (item.propCode == 'extraStream') {
							extraStream = true
						}
						if (item.propCode == 'supportVideoCall' || item.propCode == 'supportAudioCall') {
							this.isSupportVideoTalk = true
						}
						if (item.propCode == "powerSavingMode") {
							this.powerSavingMode = item
						}
						if (item.propCode == "nonSpeaker") {
							nonSpeaker = true
						}
					})
					// this.loginOrAuto();
					this.livestream()
				});
			},
			//关闭各种连接（跳转到消息页面,息屏、退到后台、杀死小程序等）
			closeAllLinks(hideType) {
				uni.hideLoading()
				if (this.isLoginSuccess) {
					if (hideType != 3) {
						this.closeLivestream();
					}
				}
				if (hideType == 1) {
					if (this.isLogin) {
						this.deviceLogOut()
					}
					clearInterval(this.timer);
					this.timer = null
					clearInterval(getApp().globalData.keepTimer);
					getApp().globalData.keepTimer = null
				}
				if (this.isPush) {
					this.isPush = false
					if (this.tempIsMute) {
						this.tempIsMute = false
						this.isMute = true
					}
				}
			},
			backAction() {
				if (this.pathType == 3) {
					uni.switchTab({
						url: '/jvss/pages/device/home'
					})
				} else {
					uni.navigateBack({})
					clearInterval()
				}
			},
			//设备退出
			deviceLogOut() {
				let token = this.device.token
				let data = {
					Name: 'Logout',
				};
				getApp().globalData.api.deviceLogOut(data, token, (result) => {
					console.log(result, '登出')
					this.$logs({
						info: '预览页退出登录',
						data: getApp().globalData.keepTimer,
						isLogin: this.isLogin,
						isLogout: this.isLogout,
						res: result
					})
				});
			},
			// 静音开关按钮
			onBindtapMuted() {
				this.isMute = !this.isMute
				if (this.isMute) {
					this.mutedIcon = 'https://statics.xmcsrv.net/weixin/soundoff2.png'
				} else {
					this.mutedIcon = 'https://statics.xmcsrv.net/weixin/soundon.png'
				}
			},
			//展示画质弹框
			changeQuality() {
				this.isShowHD = !this.isShowHD
			},
			//切换高清或标清
			selectHd(item) {
				this.$postPointData({
					code: '600806',
					eventName: 'click_monitor_video_type',
					screen_orientation: false
				})
				this.hdText = item.label
				// this.stream = item.id
				this.isShowHD = false
				this.onBindtapSDFHD()
			},
			//云回放 云事件 设置
			clickFunc(item) {
				switch (item.id) {
					case 'HD':
						this.changeStream(item)
						break;
					case 'capture':
						if (this.deviceStatus == 'LightSleep') {
							uni.showToast({
								title: this.$t('General.device.tip8'),
								icon: 'none'
							})
							return
						}
						break;
					case 'msg':
						uni.navigateTo({
							url: `${item.url}?device=${encodeURIComponent(JSON.stringify(this.device))}`
						})
						break;
					case 'sound':
						this.changeSound(item)
						break;
					case 'setting':
						this.hideType = 2
						this.$postPointData({
							code: '600807',
							eventName: 'click_monitor_setting'
						})
						uni.navigateTo({
							url: `${item.url}?device=${encodeURIComponent(JSON.stringify(this.device))}&powerSavingMode=${encodeURIComponent(JSON.stringify(this.powerSavingMode))}`
						})
						break;
					case 'cloud':
						if (this.device.xmcCssVid.support) {
							let buyUrl = '/jvss/pageCloud/buy/default?classifyId=xmc.css' + '&sn=' + this.device
								.deviceNo
						}
						uni.navigateTo({
							url: `${item.url}?device=${encodeURIComponent(JSON.stringify(this.device))}`
						})
						break;
					case 'switch':
						// this.switchCamera()
					default:
						break;
				}
			},
			//切换主辅码流
			changeStream(item) {
				this.isHd = !this.isHd
				console.log(this.isHd, '切换是不是高清', item)
				let data = {
					deviceNo: this.device.deviceNo,
					stream: null
				}
				this.onBindtapSDFHD()
				uni.showLoading({
					mask: true,
					title: '切换中...'
				});
			},
			//开关静音
			changeSound(item) {
				this.isMute = !this.isMute
				this.isClose = !this.isClose
			},
			//卡存录像  云存录像  卡存相册
			toDetail(item) {
				uni.navigateTo({
					url: `${item.url}?device=${JSON.stringify(this.device)}`
				})
			},
			// 关闭弹框
			closePopup() {
				this.$refs.popup.close()
			},
			// 循环对比获取当前设备，否则使用传参设备
			getCurrentDevice(options) {
				let device = options //JSON.parse(options.device);
				console.log('传值数据', device);
				if (device.devPassWord) {
					this.isCache = true
				} else {
					this.isCache = false
				}
				// }
				console.log(this.isCache, 'this.isCache')
			},
			/** ======================================================== 设备播放 流程 ================================================================ */
			// 第2步 手动登录或自动登录
			loginOrAuto() {
				uni.showLoading({
					title: this.$t('General.device.textLoading'),
					mask: true
				});
				// this.livestream();
				let device = this.device
				this.$refs.deviceLogin.submit(device.devUserName, device.devPassWord, device.adminToken)
			},

			// 第3步 登录
			submit(options) {
				console.log(options, '登录按钮');
				if (this.isLogout) { // 缓存登录信息
					uni.$emit('getLoginSuccess', {
						deviceNo: this.device.deviceNo,
						token: this.device.token,
						isLogout: this.isLogout
					})
				}
				this.isLogin = true
				this.saveLoginInfo(options);
				this.initKeepAlive(); // 保活
			},
			// 缓存登录信息
			saveLoginInfo(options) {
				let deviceList = uni.getStorageSync('deviceList') || [];
				this.device.devUserName = options.username;
				this.device.devPassWord = options.password;
				let isCache = false
				deviceList.forEach((item) => {
					if (this.device.deviceNo == item.deviceNo) {
						item.devUserName = options.username
						item.devPassWord = options.password
						isCache = true
					}
				})
				if (!isCache) {
					deviceList.push(this.device);
				}
				uni.setStorageSync('deviceList', deviceList);
			},
			// 第4步-1 保活
			// 20秒执行一次，当连续请求两次保活失败时，则不再保活
			initKeepAlive() {
				console.log('定时器：', this.timer);
				if (this.timer !== null) {
					clearInterval(this.timer);
					this.timer = null
				}
				getApp().globalData.keepTimer = setInterval(() => {
					this.keepAlive();
				}, 15000)
				this.timer = getApp().globalData.keepTimer
			},
			// 保活
			keepAlive() {
				let token = this.device.token;
				getApp().globalData.api.keepAlive(token, (result) => {
					// console.log('保活：', result);
					this.$logs({
						apiUrl: '保活接口',
						sn: this.device.deviceNo,
						token: token,
						result: result.data
					})
					if (result.data.code === 2000) {
						if (result.data.data.Ret === 100) {
							// 不需要操作
						} else {
							if (this.keepAliveCount === 0) {
								this.keepAliveCount = this.keepAliveCount + 1
								this.initKeepAlive();
							} else {
								clearInterval(this.timer);
							}
						}
					} else {
						if (this.keepAliveCount === 0) {
							this.keepAliveCount = this.keepAliveCount + 1
							this.initKeepAlive();
						} else {
							clearInterval(this.timer);
						}
					}
					if (this.isLogout) {
						uni.$emit('getKeepAlive', {
							deviceNo: this.device.deviceNo,
							token: this.device.token,
							isLogout: this.isLogout
						})
					}
				});
			},
			// 第4步-2 获取设备直播地址
			livestream() {
				console.log('获取直播地址')
				uni.showLoading({
					mask: true
				})
				let token = this.device.token;
				let data = {
					mediaType: 'hls', //hls
					channel: '0',
					stream: this.stream,
					protocol: 'ts',//ts fmp4
					username: this.device.devUserName,
					devPwd: this.device.devPassWord,
					userToken: uni.getStorageSync('accessToken'),
					appKey: getApp().globalData.api.appKey,
					encryptType: this.device.devPassWord ? 'DISABLE' : 'MD5',
					videoCode:'h264'
				};
				if (this.device.adminToken) {
					data.authentication = this.device.adminToken
					data.encryptType = 'TOKEN'
				}
				getApp().globalData.api.livestream(data, token, (result) => {
					uni.hideLoading()
					if (result.data.code == 2000) {
						let Ret = result.data.data.Ret
						if (result && (Ret === 100 || Ret === 104)) {
							console.log(result.data, 'livestream 获取参数');
							this.videoPlayUrl = result.data.data.url;
							console.log(this.videoPlayUrl, '播放地址')
							// this.videoPlayUrl = 'http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8';
							this.videAoutoplay = true;
							uni.showLoading({
								title: this.$t('General.device.textLoading')
							})
							setTimeout(() => {
								this.videMuted = false;
							}, 500)
							this.$forceUpdate();
						}
					}
				}, false, false);
			},
			videoErro(e) {
				console.log(e, '播放错误')
				uni.hideLoading()
				if (e.type == 'error' && this.videoPlayUrl) {
					uni.showModal({
						title: this.$t('General.device.title'),
						content: this.$t('General.device.tip6'),
						confirmColor: '#1AC0BA',
						showCancel: false,
						success: (res) => {}
					});
				}
			},
			videoPlay(e) {
				setTimeout(()=>{
					uni.hideLoading();
					uni.showToast({
						title: this.$t('General.device.tip7'),
						icon: 'none'
					})
				},800)
				console.log(e, '播放成功')
			},
			// 获取设备最新的adminToken
			getAdminToken(type) {
				let data = {
					deviceNo: this.device.deviceNo,
					isLatest: true
				}
				getApp().globalData.api.getDeviceTokenLocal(data, (result) => {
					this.device.adminToken = result.adminToken
					if (type == 'talk') {} else {
						this.livestream()
					}
				});
			},
			// 停止设备码流
			closeLivestream(stream, callback) {
				const token = this.device.token;
				const data = {
					channel: '0',
					stream: stream || this.stream,
					PassWord: this.device.devPassWord,
					UserName: this.device.devUserName,
					encryptType: 'DISABLE',
					authentication: this.device.adminToken
				};
				getApp().globalData.api.closeLivestream(data, token, (result) => {
					console.log('停止设备码流:', result);
					this.isLoginSuccess = false
					if (typeof callback === 'function') {
						callback();
					}
				});
			},
			//获取当前时间
			getCurrentTime() {
				let time = new Date()
				let time1 = time.getHours() + ':' + time.getMinutes() + ':' + time.getSeconds() + ':' + time
					.getMilliseconds()
				return time1
			},
			/** ======================================================== video回调 ================================================================== */
			// 显示隐藏控条bar
			bindtap() {
				console.log('binftap');
				this.isShowBar = !this.isShowBar
				if (!this.isShowBar) {
					this.isShowHD = false
				}

			},
			// 当开始/继续播放时触发play事件
			bindplay(ev) {
				console.log('当开始/继续播放时触发play事件:', ev);
			},

			// 当暂停播放时触发 pause 事件
			bindpause(ev) {
				console.log('当暂停播放时触发 pause 事件:', ev);
			},

			// 当播放到末尾时触发 ended 事件
			bindended(ev) {
				console.log('当暂停播放时触发 pause 事件:', ev);
			},

			// 播放进度变化时触发
			bindtimeupdate(ev) {
				// console.log('播放进度变化时触发:',ev);
				if (this.isLoading) {
					this.isLoading = false
				}
			},

			// 视频进入和退出全屏时触发
			bindfullscreenchange(ev) {
				console.log('视频进入和退出全屏时触发:', ev);
			},

			// 视频出现缓冲时触发
			bindwaiting(ev) {
				console.log('视频出现缓冲时触发:', ev);
				this.isLoading = true
				this.loadingText = this.$t('General.device.buffering')
			},

			// 视频播放出错时触发
			binderror(ev) {
				console.log('视频播放出错时触发:', ev);
				uni.showModal({
					title: this.$t('General.device.title'),
					content: this.$t('General.device.tip10'),
					showCancel: false,
					success: (res) => {
						if (res.confirm) {
							let tokenList = [this.device.token];
							this.getDeviceStatus(tokenList, this.deviceList)
						}
					}

				});
			},

			// 加载进度变化时触发，只支持一段加载
			bindprogress(ev) {
				// console.log('加载进度变化时触发，只支持一段加载:', ev);
			},

			// 视频元数据加载完成时触发
			bindloadedmetadata(ev) {
				console.log('视频元数据加载完成时触发:', ev);
			},

			// 切换 controls 显示隐藏时触发
			bindcontrolstoggle(ev) {
				console.log('切换 controls 显示隐藏时触发:', ev);
			},

			// 播放器进入小窗
			bindenterpictureinpicture(ev) {
				console.log('播放器进入小窗:', ev);
			},

			// 播放器进入小窗
			bindleavepictureinpicture(ev) {
				console.log('播放器退出小窗:', ev);
			},

			// seek 完成时触发
			bindseekcomplete(ev) {
				console.log('seek 完成时触发:', ev);
			},

			/** ================================================== 标高清切换 & 截图 =================================================================== */
			// 标清高清切换
			onBindtapSDFHD() {
				if (this.stream === '1') {
					this.isLoading = true
					this.loadingText = '切换为标清...'
					this.url = ''
					this.streamText = '标清'
					this.streamTextIcon = 'SD'
				} else {
					this.isLoading = true
					this.loadingText = '切换为高清...'
					this.url = ''
					this.streamText = '高清'
					this.streamTextIcon = 'FHD'
				}

				this.closeLivestream(this.stream == '0' ? '1' : '0', () => {
					// if (this.stream === '0') {
					// 	this.stream = '1'
					// } else {
					// 	this.stream = '0'
					// }
					setTimeout(() => {
						this.livestream();
					}, 3000);
				});
			},

			/**===================================================== 其他 ============================================================================= */
			// 全屏
			onBindtapFullScreen(ev) {
				console.log('全屏：', ev);
				this.videoContext.requestFullScreen();
				this.isFullScreen = true
			},

			// 取消全屏
			onBindtapExitFullScreen(ev) {
				console.log('取消全屏：', ev);
				this.videoContext.exitFullScreen();
				this.isFullScreen = false
			},

			// 云服务
			onBindtapCloud() {
				uni.navigateTo({
					url: `/jvss/pagesDevice/device/device-live/cloud/cloud?device=${JSON.stringify(this.device)}`
				});
			},

			// 云回放
			onBindtapReplay() {
				uni.navigateTo({
					url: `/jvss/pagesDevice/device/device-live/replay/replay?device=${JSON.stringify(this.device)}`
				});
			},

			// 设置
			onBindtapSetting() {
				uni.navigateTo({
					url: `/jvss/pagesDevice/device/device-live/setting/setting?device=${JSON.stringify(this.device)}`
				});
			},

			showOk() {
				this.talkStatus = false
				this.backAction()
			}
		}
	};
</script>

<style>
</style>